﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>注册</title>
    @*    <script src="~/Scripts/jquery-1.10.2.min.js"></script>*@
    <link href="~/Content/validform.css" rel="stylesheet" />
    <script src="~/Scripts/Validform_v5.3.2_min.js"></script>
    <script src="~/Scripts/Validform_Datatype.js"></script>
    <script type="text/javascript">
        $(function () {
            $("form").Validform({
                tiptype: 3
            });

            $("#btnSendCode").click(function () {
                if ($("#Mobilenumber").val().trim() != "") {
                    sendMessage();
                } else {
                    $.dialog.tips("请输入手机号码", 2, 'tips.gif');
                }
            });
        });

        function OnSuccess(data) {
            if (data.Status == -1) {
                alert(data.Message);
                return false;
            } else {
                window.location.href = "/Account/Index";
            }
            return false;
        }

        /*-------------------------------------------*/
        var InterValObj; //timer变量，控制时间
        var count = 120; //间隔函数，1秒执行
        var curCount;//当前剩余秒数
        var code = ""; //验证码
        var codeLength = 6;//验证码长度
        function sendMessage() {
            curCount = count;
            var Phone = $("#Mobilenumber").val();

            //设置button效果，开始计时
            $("#btnSendCode").attr("disabled", "true");
            $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");

            //向后台发送处理数据
            $.ajax({
                url: '/tools/AdminAjax.ashx?action=get_validate_code&phone=' + Phone + '&sign=user_register', //目标地址
                type: "Get", //用POST方式传输  
                datatype: "json",
                error: function (XMLHttpRequest, textStatus, errorThrown) { },
                success: function (msg) {
                    InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
                }
            });
        }
        //timer处理函数
        function SetRemainTime() {
            if (curCount == 0) {
                window.clearInterval(InterValObj);//停止计时器
                $("#btnSendCode").removeAttr("disabled");//启用按钮
                $("#btnSendCode").val("重新发送验证码");
                code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
            }
            else {
                curCount--;
                $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
            }
        }


    </script>
    <style type="text/css">
        .username_text {
            margin-left: 280px;
            width: 80px;
            height: 40px;
            line-height: 40px;
            float: left;
            font-size: 14px;
            color: #999;
            /*margin: 10px 0px;*/
        }

        .text_input {
            /*margin-left:140px;*/
            border: 0px;
            height: 38px;
            width: 358px;
            text-indent: 1em;
            font-size: 18px;
        }

        .login_clear {
            clear: both;
            width: 100%;
            height: 2px;
            margin: 0px 0px 20px 0px;
        }

        #GetValidateCodeDiv {
            margin-top: -60px;
            margin-left: 272px;
        }

        #Register {
            background-color: #c61010;
            color: #fff;
            height: 40px;
            width: 370px;
            border: 0px;
            font-size: 18px;
            font-family: 'Microsoft YaHei';
            font-weight: 600;
        }

        .validateCodeButton {
            background-color: #c61010;
            color: #fff;
            height: 40px;
            width: 140px;
            border: 0px;
            font-size: 12px;
            font-family: 'Microsoft YaHei';
            font-weight: 600;
            margin-left: 20px;
        }

        .input {
            padding: 5px 4px;
            min-height: 28px;
            line-height: 28px;
            border: 1px solid #d4d4d4;
            background: #fff;
            vertical-align: middle;
            color: #333;
            font-size: 100%;
        }

            .input.normal {
                width: 280px;
            }

            .input.disabled {
                border: 0px solid #d4d4d4;
            }

            .input.txt {
                width: 130px;
            }

            .input:focus {
                background: #FFFBDE;
                border-color: #d4d4d4;
                outline: 1px solid #d4d4d4;
            }

        #main_login a {
            color: #005ea7;
            font-size: 12px;
        }

            #main_login a:hover {
                color: #C81623;
            }
    </style>
</head>
<body>
    <div class="line10"></div>
    <div id="main_body">
        <div id="main_login" style="min-height: 580px;">
            @using (Ajax.BeginForm("MemberSave", new AjaxOptions() { OnSuccess = "OnSuccess" }))
            {
               
                <div style="font-family: 'Microsoft YaHei'; text-align: center; font-weight: 800; color: #c61010; font-size: 18px; line-height: 100px;">会员注册</div>
             
                <div class="login_clear"></div>
                <div class="username_text">注册手机：</div>
                <div class="username_input">
                    <input type="text" name="Mobilenumber" id="Mobilenumber" class="input normal" placeholder="手机号码" datatype="m" sucmsg=" " ajaxurl="/tools/AdminAjax.ashx?action=validate_phone" />
                </div>
                <div class="login_clear"></div>
                <div class="username_text">登录密码：</div>
                <div class="username_input">
                    <input type="password" maxlength="20" name="userPwd" id="userPwd" class="input normal" datatype="*6-20" nullmsg="请输入新密码" errormsg="密码范围在6-20位之间" sucmsg=" " />
                </div>
                <div class="login_clear"></div>
                <div class="username_text">确认密码：</div>
                <div class="username_input">
                    <input type="password" maxlength="20" name="userPwd2" class="input normal" datatype="*6-20" recheck="userPwd" nullmsg="请再输入一次新密码" errormsg="两次输入的密码不一致" sucmsg=" " />
                </div>
                <div class="login_clear"></div>
                <div class="username_text">短信验证：</div>
                <div class="username_input" style="width: 130px; float: left;">
                    <input type="text" name="validateCode" class="input txt" datatype="*" ajaxurl="/tools/AdminAjax.ashx?action=validate_SESSION_SMS_CODE" />
                </div>
                <input type="button" id="btnSendCode" value="获取验证码" class="validateCodeButton" />
                <div class="clear"></div>
                <div class="login_clear"></div>
                
                <div class="username_text">邀请码：</div>
                <div class="username_input">
                    <input type="text" name="MemberId" class="input normal" />
                </div>
                <div class="login_clear"></div>
                <div style="margin-left: 280px">
                    <input type="submit" id="Register" value="立即注册" />
                </div>
                <div class="login_clear"></div>
            }

        </div>
    </div>
    <div class="line10"></div>
</body>
</html>
